<!doctype html>
<html>

<head>
    <include file="public/head" />
    <title>创建直播间</title>
    <script type="text/html" id="photos-item-tpl">
        <li id="saved-image{id}">
            <input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
            <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
                   style="width: 200px;" title="图片名称">
            <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
                 onclick="imagePreviewDialog(this.src);">
            <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
            <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
        </li>
    </script>
</head>

<body>
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:cmf_plugin_url('WxappBroadcast://AdminIndex/index')}">直播间列表</a></li>
            <li class="active"><a>创建直播间</a></li>

        </ul>
        <form method="post" class="form-horizontal js-ajax-form margin-top-20 layui-form"
            action="{:cmf_plugin_url('WxappBroadcast://AdminIndex/createPost')}" enctype="multipart/form-data">

            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="form-required">*</span>名称</label>
                <div class="col-md-6 col-sm-10">
                    <input type="hidden" class="form-control" name="id" value="{$room.id|default=0}">
                    <input type="text" class="form-control" name="name" id='name' value="{$room.name|default=''}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="form-required">*</span>背景图</label>
                <div class="col-md-6 col-sm-10">
                    <input type="hidden" name="coverImg" id="coverImg" value="">
                    <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                        <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                id="thumbnail-preview"
                                width="135" style="cursor: pointer"/>
                    </a>
                    <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                </div>
            </div>
            
            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="form-required">*</span>直播计划开始时间</label>
                <div class="col-md-6 col-sm-10">
                    <input class="js-datetime" type="text" id="input-datetime" placeholder="点击选择"
                        name="datetime">{:date('Y-m-d H:i:s',strtotime('+10 minute'))}
                        <p>开播时间需要在当前时间的10分钟后 并且 开始时间不能在 6 个月后</p>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="form-required">*</span>直播计划结束时间</label>
                <div class="col-md-6 col-sm-10">
                    <input class="js-datetime" type="text" id="input-datetime"  placeholder="点击选择"
                        name="datetime">{:date('Y-m-d H:i:s',strtotime('+40 minute'))}
                        <p>开播时间和结束时间间隔不得短于30分钟，不得超过24小时</p>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="form-required">*</span>主播昵称</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="anchorName" id='anchorName'
                        value="{$room.anchorName|default=''}">
                </div>
            </div>
            
            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="form-required">*</span>主播微信号</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="anchorWechat" id='anchorWechat'
                        value="{$room.anchorWechat|default=''}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">主播副号微信号</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="subAnchorWechat" id='subAnchorWechat'
                        value="{$room.subAnchorWechat|default=''}">
                </div>
            </div>
            
            <div class="form-group">
                <label class="col-sm-2 control-label">创建者微信号</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" name="createrWechat" id='createrWechat'
                        value="{$room.createrWechat|default=''}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="form-required">*</span>分享图</label>
                <div class="col-md-6 col-sm-10">
                    <input type="file" id="shareImg" name="shareImg" onchange="getFileName()">
                </div>
            </div>

            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary">提 交</button>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript">
        $(function () {

            editorcontent = new baidu.editor.ui.Editor();
            editorcontent.render('content');
            try {
                editorcontent.sync();
            } catch (err) {
            }

            $('.btn-cancel-thumbnail').click(function () {
                $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
                $('#coverImg').val('');
            });

        });
    </script>
    <include file="public/scripts" />
</body>

</html>